package com.mlnx.data.service.iml;

import com.mlnx.common.form.PageForm;
import com.mlnx.common.utils.MyLog;
import com.mlnx.data.dao.SpoStore;
import com.mlnx.data.entity.SpoInfo;
import com.mlnx.data.pojo.form.SpoInfoForm;
import com.mlnx.data.pojo.vo.SpoInfoVo;
import com.mlnx.data.service.SpoDataService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.validation.Valid;
import java.util.List;

/**
 * Created by amanda.shan on 2019/11/19.
 */
@Service
public class SpoDataServiceIml implements SpoDataService {

    private MyLog log = MyLog.getLog(getClass());

    @Autowired
    private SpoStore spoStore;


    @Override
    public void save(SpoInfo spoInfo) {
        spoStore.save(spoInfo);
    }

    @Override
    public List<SpoInfo> getSpos(Integer patientId, Long startTime, Long endTime) {
        return spoStore.getSpos(patientId,startTime,endTime);
    }

    @Override
    public void updateSpos(List<SpoInfo> spoInfos) {
        for (SpoInfo spoInfo:spoInfos){
            spoStore.updateSpo(spoInfo);
        }

    }

    @Override
    public void deleteSpos(List<SpoInfo> spoInfos) {
        for (SpoInfo spoInfo:spoInfos){
            spoStore.deleteSbp(spoInfo);
        }

    }

    @Override
    public SpoInfoVo getAllSpos(PageForm pageForm, @Valid SpoInfoForm spoInfoForm) {
        return spoStore.getPageSpos(pageForm,spoInfoForm);
    }
}
